<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>{{ student_name }}的钢琴课成绩 - The ONE 智能钢琴教室</title>
	<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no,minimal-ui">	
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=no,email=no">
	<link rel="shortcut icon" href="{{ url_for('static', filename='icons/favicon.ico') }}">
	<link rel="stylesheet" href="{{ url_for('static', filename='css/mobile.css')}}?v=20150823">
</head>
<body class="record-new-page">
	<header class="m-nav-top">
		<div class="top">
			<span class="student" style="margin-left:10px;">学生：{{ student_name }}</span>
      <a href="{{ url_for('wechat.chstu',student_id=student_id) }}" style="color:#fff;float:right;text-decoration:underline;">切换学生</a>
		</div>
	</header>
	<div class="m-record-new">
		<ul class="lists study_record_list_menu">
      <div id="load_records" style="display:none"></div>
		</ul>
	  <div class="more">加载中...</div>
	</div>
<script src="{{ url_for('static', filename='libs/jquery.min.js') }}"></script>
<script>
$(function(){
  var pages,
      page=1;
  recreate_records();
  function get_records(){
      get_pages();
    var more_position = $('.more').offset().top - $(document).scrollTop();
    if( (page < pages) &&  (0 < more_position) && (more_position < $(window).height()) ){
		  if(parseInt(pages) > page){
			page +=1;
		  }
      recreate_records();
    }
  }
  function recreate_records(){
      $('.more').text("加载中..."); 
      $.get( "{{ url_for('wechat.record_by_session') }}",
          { is_ajax: 1, student_id: {{ student_id }}, page: page},
          function( data ) {
            $('#load_records').before(data);
            if(page < pages){
              $('.more').text("下拉加载更多"); 
            }else{
              $('.more').text("没有更多了"); 
            }
      }); 
  }
  function get_pages(){
    var map_pages = $(".study_record_list_menu").find('.map_pages:first');
    if(map_pages.length > 0){
        pages = parseInt(map_pages.text());
    }
  }
  
  $(window).scroll(get_records);
});
</script>
</body>
</html>
